include('shared.lua')

function ENT:Initialize()
	while self.Entity:GetNetworkedString("damagetype") == nil do end
	self.Entity.DamageType = self.Entity:GetNetworkedString("damagetype")
	local colorvec = self.Entity:GetNetworkedVector("color")
	self.Entity.Color = Color(colorvec.x, colorvec.y, colorvec.z)
	if self.Entity.RenderMode == "pulse" then
		if self.Entity.DamageType == "normal" then
			CDEffect_sprite_sustained(self.Entity, Vector(0, 0, 0), self.Entity.Color, 50, 254, 6, true)
			CDEffect_beam_trail(self.Entity, 8, self.Entity.Color, 255, 10, 0, "CDE/beam_thin", false)
		elseif self.Entity.DamageType == "destructive" then
			CDEffect_sprite_sustained(self.Entity, Vector(0, 0, 0), self.Entity.Color, 50, 100, 2, true)
			CDEffect_sprite_sustained(self.Entity, Vector(0, 0, 0), self.Entity.Color, 50, 254, 3, true)
			CDEffect_beam_trail(self.Entity, 8, self.Entity.Color, 255, 10, 0, "CDE/beam_thin", false)
			CDEffect_beam_trail(self.Entity, 4, self.Entity.Color, 255, 10, 0, "CDE/beam_thick", false)
		elseif self.Entity.DamageType == "anti-shield" then
			CDEffect_sprite_sustained(self.Entity, Vector(0, 0, 0), self.Entity.Color, 50, 200, 6, true)
			CDEffect_sprite_sustained(self.Entity, Vector(0, 0, 0), self.Entity.Color, 100, 254, 7, true)
			CDEffect_beam_trail(self.Entity, 8, self.Entity.Color, 255, 10, 0, "CDE/beam_thin", false)
			CDEffect_beam_trail(self.Entity, 4, self.Entity.Color, 255, 5, 0, "CDE/Distort", false)
		end
	else
		if self.Entity.DamageType == "normal" then
			CDEffect_beam_trail(self.Entity, 8, self.Entity.Color, 255, 10, 10, "CDE/beam_thin", false, true)
		elseif self.Entity.DamageType == "destructive" then
			CDEffect_beam_trail(self.Entity, 8, self.Entity.Color, 255, 10, 10, "CDE/beam_thin", false, true)
			CDEffect_beam_trail(self.Entity, 8, self.Entity.Color, 255, 5, 5, "CDE/beam_thick", false, true)
		elseif self.Entity.DamageType == "anti-shield" then
			CDEffect_beam_trail(self.Entity, 8, self.Entity.Color, 255, 10, 10, "CDE/beam_thin", false, true)
			CDEffect_beam_trail(self.Entity, 8, self.Entity.Color, 255, 1, 1, "CDE/Distort", false, true)
		end
	end
end

function ENT:Draw() 
	CDEffect_client_processall(self.Entity)
end